const BASE_STYLE = [
  {
    active: true,
    url: './data/baseStyle.json',
    icon: './img/vector-light.png',
    name: '亮灰矢量',
  },
  {
    active: false,
    url: './data/vector.json',
    icon: './img/vector.png',
    name: '矢量',
  },
  {
    active: false,
    url: './data/raster.json',
    icon: './img/raster.png',
    name: '影像',
  },
]
const BASE_LAYER = ''
const CITY_LAYERS = [
  // {
  //   id: '主城区初始显现图层',
  //   visible: true,
  //   style:
  //     'http://103.131.169.87:89/oms/static/stylejson/5591914f-c63b-4fd0-82c6-88fde9089a4b.json',
  // },
]
const BULIDING_LAYERS = [
  {
    id: '用途图例',
    visible: true,
    style:
      'http://chengyu.caupdwest.com:7000/map/oms/static/stylejson_net/396942c5-f0af-4843-b5b7-bfcf325cfc9c.json',
  },
]
const BULIDING_LAYERS_LIST = [
  {
    id: '用途图例',
    visible: true,
    style:
      'http://chengyu.caupdwest.com:7000/map/oms/static/stylejson_net/396942c5-f0af-4843-b5b7-bfcf325cfc9c.json',
  },
  {
    id: '结构图例',
    visible: true,
    style:
      'http://chengyu.caupdwest.com:7000/map/oms/static/stylejson_net/aa4e35da-de5e-42fd-aaea-68e811002248.json',
  },
  {
    id: '年份图例',
    visible: true,
    style:
      'http://chengyu.caupdwest.com:7000/map/oms/static/stylejson_net/f88f886e-2851-4f53-b368-5cd6f8a9433e.json',
  },
  {
    id: '楼层图例',
    visible: true,
    style:
      'http://chengyu.caupdwest.com:7000/map/oms/static/stylejson_net/0506613f-2c0b-47bb-901e-5cce2f9b2950.json',
  },
]
const EVALUATE_LAYERS = [
  {
    id: '社区初始显现图层带过滤器',
    visible: true,
    style:
      'http://103.131.169.87:89/oms/static/stylejson/2e54fef8-beb7-4cda-b64e-92718249b648.json',
  },
]
const TIMELINE_STYLE_NAME = '用途图例'

// 环境检测函数
const getEnvironment = () => {
  const hostname = window.location.hostname
  const port = window.location.port
  // 生产环境检测
  const isProduction = hostname === 'chengyu.caupdwest.com' 
  
  // 开发环境检测
  const isDevelopment = hostname === 'localhost'
  
  if (isProduction) {
    return 'production'
  } else if (isDevelopment) {
    return 'development'
  } else {
    return 'development'
  }
}

// 根据环境模式设置不同的 API 基础地址
const { BASE_URL, TEMPLATE_PATH_URL } = (function () {
  const env = getEnvironment()

  const isProd = env === 'production'

  return {
    BASE_URL: isProd
      ? 'https://chengyu.caupdwest.com:8000/city2025/api'
      : '/city/api',

    TEMPLATE_PATH_URL: isProd
      ? 'https://chengyu.caupdwest.com:8000/city-inspect-2025'
      : './',
  }
})()


const BASE_FILE_URL ='https://chengyu.caupdwest.com:8000/city2025/api/file'
//const Base8080 = '/mock8080';
const Base7774 = '/mock7774'
const geojsonPath = ''
const gaodeUrl = 'http://localhost:8080/gaode'
const buildingServiceUrl =
  'https://chengyu.caupdwest.com:8000/oms/static/stylejson/c43ebf4c-f165-4b5c-97cc-15a7f0b96de5.json'
/**
 * 建筑年代服务地址
 */
const buildingAgeServiceUrl =
  'https://chengyu.caupdwest.com:8000/oms/static/stylejson/4a298bb3-d90e-40dc-b577-f1bfcd05bafd.json'
// const TIMELINE_STYLE_NAME = '用途图例';
// const BASE_URL = 'http://10.23.100.71:7771/';//部署
// const Base8080 = 'http://10.23.100.71:8080/';
// const geojsonPath = './';
// const gaodeUrl = 'http://124.70.64.99:89/gaode';
window.templatePathUrl = TEMPLATE_PATH_URL
window.geojsonPath = geojsonPath
window.gaodeUrl = gaodeUrl
// 请求地址
window.BASE_URL = BASE_URL
window.BASE_FILE_URL = BASE_FILE_URL
window.buildingServiceUrl = buildingServiceUrl
window.buildingAgeServiceUrl = buildingAgeServiceUrl
window.Base7774 = Base7774
window.Base8080 = BASE_URL + 'building/'
// 城市体检模块，默认初始化显现图层
window.CITY_LAYERS = CITY_LAYERS
// 城市xx模块，默认初始化显示图层
window.BULIDING_LAYERS = BULIDING_LAYERS
// 专项评估模块，默认初始化显现图层
window.EVALUATE_LAYERS = EVALUATE_LAYERS
// 暂时无用
window.BASE_LAYER = BASE_LAYER
// 地图底图集
window.BASE_STYLE = BASE_STYLE
// 时间轴样式id
window.TIMELINE_STYLE_NAME = TIMELINE_STYLE_NAME
// 图例切换列表
window.BULIDING_LAYERS_LIST = BULIDING_LAYERS_LIST
window.BIG_SCREEN_URL = getEnvironment() === 'production' ? 'http://chengyu.caupdwest.com:7000/city-exam-2025-big-screen-temp/#/home' : 'http://localhost:6500/#/home'
window.BULIDING_LAYER_URL = getEnvironment() === 'production' ? 'https://chengyu.caupdwest.com:8000/oms/static/stylejson/9e7bbd7d-6962-473e-a1ab-62438899ebaa.json' :
'http://113.204.235.238:7000/oms/static/stylejson/9e7bbd7d-6962-473e-a1ab-62438899ebaa.json'

window.INSTRUCTION_URL = getEnvironment() === 'production' ? 'https://chengyu.caupdwest.com:8000/city-inspect-2025/#/markdown-preview' 
:'http://localhost:8080/#/markdown-preview'

window.BOUND_LAYER_URL = 'https://chengyu.caupdwest.com:8000/oms/static/stylejson/ff20c960-8ee6-4946-bad5-3df0ce48db8b.json'
